package com.one_to_one;


import com.bean.*;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CardMapper {
    //查询全部
    @Select("SELECT * FROM card")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "number",property = "number"),
            @Result(
                    property = "p",
                    javaType = Person.class,
                    column = "pid",
                    /*
                        one,@one 一对一固定写法
                        select属性:指定调用哪个接口的哪个方法
                     */
                    one = @One(select = "com.one_to_one.PersonMapper.selectById")

            )
    })
    public abstract List<Card> selectAll();
}
